<template>
	<view :class="bgClass">
		<uv-row customStyle="flex-wrap: wrap;" gutter="5">
			<uv-col span="6" v-for="(item,index) in rows" :key="index">

				<view  class="css-padding-sm css-radius css-bg-white">
					<view class="css-flex-x css-align-center css-gap" @click="dumpPage('pages/goods/goods',{id:item.id,goodsId:item.goods_id,number:item.number,fromApi:item.from_api,province:item.province,city:item.city,preMoney:item.pre_money,in_name:item.in_name,price:item.sale_price
})"> 
						<view>
							<text class="css-text-bold css-text-xl">
								{{item.number}}
							</text>
						</view>
					</view>
					<view class="css-flex-x css-align-center css-gap" @tap="dumpPage('pages/goods/goods',{id:item.id,goodsId:item.goods_id,number:item.number,fromApi:item.from_api,province:item.province,city:item.city,preMoney:item.pre_money,in_name:item.in_name,price:item.sale_price
})">
						<view><text class="css-text-df css-text-gray">{{item.city}}{{item.operator}}</text></view>

						<view v-if="!isEmpty(item.symbol)">
							<text
								class="css-radius css-padding-lr-xs css-text-df css-bg-yellow-light">{{item.symbol}}</text>
							<!-- <uv-tags :text="item.symbol" plain size="mini" type="warning"></uv-tags> -->
						</view>
					</view>
					<view class="css-margin-top-sm css-flex-x css-justify-between css-align-center">
						<view class="css-flex-x css-align-center"
							@tap="dumpPage('pages/goods/goods',{id:item.id,goodsId:item.goods_id,number:item.number,fromApi:item.from_api,province:item.province,city:item.city,preMoney:item.pre_money,price:item.sale_price})">
							<view>
								<text class="css-text-red css-text-df">￥{{item.sale_price || 0}}</text>
							</view>
							<view v-if="!isEmpty(item.pre_money)">
								<text class="css-text-gray css-text-df">(话费:￥{{item.pre_money}})</text>
							</view>
						</view>

						<view>
							<uv-icon :name="item.fav==1 ?'star-fill':'star'" :color="item.fav==1 ? '#f9ae3d':'#909399'"
								size="20"></uv-icon>
						</view>
					</view>
				</view>
				<uv-gap height="5"></uv-gap>
			</uv-col>
		</uv-row>
	</view>
</template>

<script>
	export default {
		name: "cu-number-list",
		props: {
			rows: {
				type: [Array, Object],
				default () {
					return []
				}
			},
			bgClass: {
				type: String,
				default: 'css-bg-gray'
			}
		},
		data() {
			return {
				serverHost: ''
			};
		},
		created() {
			// console.log(this.rows)
			// this.serverHost = uni.$my.serverHost
		},
		methods: {
			isEmpty(item) {
				return uni.$uv.test.empty(item)
			},
			getProperty(obj, key) {
				return uni.$uv.getProperty(obj, key);
			},
			dumpPage(page, params, type) {
				uni.$my.dumpPage(page, params, type)
			},
		}
	}
</script>

<style>

</style>